From c4d1247d009d8c0327629fe4b13e089dca87d0c6 Mon Sep 17 00:00:00 2001 From: "kfraser@localhost.localdomain" Date: Fri, 6 Jul 2007 16:16:57 +0100 Subject: [PATCH] hvm: Add global default keymap setting Add global default keymap setting to be used when a VM does not have a keymap configuration set. Signed-off-by: Pat Campbell --- tools/examples/xend-config.sxp | 6 ++++++ tools/python/xen/xend/XendConfig.py | 4 ++++ tools/python/xen/xend/XendOptions.py | 3 +++ tools/python/xen/xend/server/vfbif.py | 5 +++++ 4 files changed, 18 insertions(+) diff --git a/tools/examples/xend-config.sxp b/tools/examples/xend-config.sxp index aaddbee076..adbb9e6b69 100644 --- a/tools/examples/xend-config.sxp +++ b/tools/examples/xend-config.sxp @@ -191,3 +191,9 @@ # The default password for VNC console on HVM domain. # Empty string is no authentication. (vncpasswd '') + +# The default keymap to use for the VM's virtual keyboard +# when not specififed in VM's configuration +#(keymap 'en-us') + + diff --git a/tools/python/xen/xend/XendConfig.py b/tools/python/xen/xend/XendConfig.py index 17628f337a..0773724919 100644 --- a/tools/python/xen/xend/XendConfig.py +++ b/tools/python/xen/xend/XendConfig.py @@ -22,6 +22,7 @@ import types from xen.xend import sxp from xen.xend import uuid +from xen.xend import XendOptions from xen.xend import XendAPIStore from xen.xend.XendError import VmError from xen.xend.XendDevices import XendDevices @@ -392,6 +393,9 @@ class XendConfig(dict): def _platform_sanity_check(self): if self.is_hvm(): + if 'keymap' not in self['platform'] and XendOptions.instance().get_keymap(): + self['platform']['keymap'] = XendOptions.instance().get_keymap() + if 'device_model' not in self['platform']: self['platform']['device_model'] = DEFAULT_DM diff --git a/tools/python/xen/xend/XendOptions.py b/tools/python/xen/xend/XendOptions.py index 73de5a39c3..af09220782 100644 --- a/tools/python/xen/xend/XendOptions.py +++ b/tools/python/xen/xend/XendOptions.py @@ -278,6 +278,9 @@ class XendOptions: return self.get_config_string('vncpasswd', self.vncpasswd_default) + def get_keymap(self): + return self.get_config_value('keymap', None) + class XendOptionsFile(XendOptions): """Default path to the config file.""" diff --git a/tools/python/xen/xend/server/vfbif.py b/tools/python/xen/xend/server/vfbif.py index cbef190248..eb1990e64f 100644 --- a/tools/python/xen/xend/server/vfbif.py +++ b/tools/python/xen/xend/server/vfbif.py @@ -76,6 +76,11 @@ class VfbifController(DevController): args += [ "--listen", vnclisten ] if config.has_key("keymap"): args += ["-k", "%s" % config["keymap"]] + else: + xoptions = xen.xend.XendOptions.instance() + if xoptions.get_keymap(): + args += ["-k", "%s" % xoptions.get_keymap()] + spawn_detached(args[0], args + std_args, os.environ) elif t == "sdl": args = [xen.util.auxbin.pathTo("xen-sdlfb")] -- 2.30.2